/****************************************Copyright (c)****************************************************

**--------------File Info---------------------------------------------------------------------------------
** File name:                sht30.h
** Last modified Date:       2024.11.28
** Last Version:             Ver:1.0
** Descriptions:             SHT30温湿度IC驱动
**
**--------------------------------------------------------------------------------------------------------
** Created by:               adm
** Created date:             2024.11.28
** Version:                  Ver:1.0
** Descriptions:             使用本驱动，需要调用i2c_application中间件
**--------------------------------------------------------------------------------------------------------*/
#ifndef SHT30_H
#define SHT30_H

#include "at32f415_wk_config.h"


/**************************I2C地址****************************/
#define SHT30_ADDRESS1      0x88
#define SHT30_ADDRESS2      0x8A

#define CRC8_POLYNOMIAL     0x31
/**************************SHT30命令****************************/
#define SHT30_MEAS_HIGHREP_STRETCH          0x2C06
#define SHT30_MEAS_MEDREP_STRETCH           0x2C0D
#define SHT30_MEAS_LOWREP_STRETCH           0x2C10
#define SHT30_MEAS_HIGHREP                  0x2400
#define SHT30_MEAS_MEDREP                   0x240B
#define SHT30_MEAS_LOWREP                   0x2416
#define SHT30_READSTATUS                    0xF32D
#define SHT30_CLEARSTATUS                   0x3041
#define SHT30_SOFTRESET                     0x30A2
#define SHT30_HEATEREN                      0x306D
#define SHT30_HEATERDIS                     0x3066

extern i2c_handle_type hi2c2_SHT30;

/**************************API****************************/
void SHT30_Init(void);
error_status SHT30_Read_Temperature_Humidity(float *Temperature, float *Humidity, uint8_t addr_select);
uint16_t SHT30_Read_Status(uint8_t addr_select);
void SHT30_reset(uint8_t addr_select);
void SHT30_heater(uint8_t en, uint8_t addr_select);
uint8_t SHT30_CheckCrc8(uint8_t* const message, uint16_t len);



#endif /* SHT40_H */
